import request from "./request";
import qs from "qs";

// 获取用户登录信息
export const getUserByToken = (data) =>
  request.post("/admin/auth/getUserByToken", data);

// 登录
export const getLogin = (data) => {
  // console.log(data);
  return request.post("/admin/auth/login", data);
};

// 获取商品列表
export const getGoods = (params) => request.get("/admin/goods", { params });

// 上传图片
export const UploadPicture = (data) =>
  request.post("/admin/upload/goodNewPic", data);

// 查询品牌列表
export const getBrands = (params) => request.get("/admin/brand", { params });

// 新增/编辑品牌详情
export const editBrand = (data) => request.post("/admin/brand/store", data);

// 品牌详情
export const getBrandDesc = (params) =>
  request.get("/admin/brand/info", { params });

// 属性列表
export const getAttribute = (params) =>
  request.get("/admin/attribute", qs.stringify({ params })); // 将Json格式转化为X-WWW-FORM-URLENCODED

// 属性详情
export const getAttributeDesc = (params) =>
  request.get("/admin/attribute/info", qs.stringify({ params }));

// 查询分类
export const getCategory = (params) =>
  request.get("/admin/category", qs.stringify({ params }));
